﻿using LJX.SmartPark.Common.ResponseOutput;
using LJX.SmartPark.Domain.AssetManage;
using LJX.SmartPark.Domain.EnergyManage;
using LJX.SmartPark.Service.EnergyManage.Stoichio;
using LJX.SmartPark.Service.EnergyManage.Stoichio.Dto;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace LJX.SmartPark.WebApi.Controllers.EnergyManage
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    [ApiExplorerSettings(GroupName = "EnergyManage")]
    public class EnergyManageController : ControllerBase
    {
        private readonly IEquipmentTypeSerive equipment;

        public EnergyManageController(IEquipmentTypeSerive equipment)
        {
            this.equipment = equipment;
        }

        #region 设备类型全部数据

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<EquipmentType>> GetEquipmentTypeAsync()
        {
            var result = equipment.GetEquipmentTypeAsync();



            return result.Result;
        }

        #endregion

        #region 能耗管理

        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public Response<List<EquipmentTypeDto>> GetUseEnergyAsync(Use use)
        {
            var result = equipment.GetUseEnergyAsync(use);
            return result.Result;
        }

        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<Response<bool>> PostUseEnergy(LJX.SmartPark.Domain.EnergyManage.UseEnergy input)
        {
            var result = equipment.PostUseEnergy(input);
            return result;
        }

        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="input"></param>
        [HttpDelete]
        public Task<Response<bool>> DeleteByIdUseEnergyAsync(LJX.SmartPark.Domain.EnergyManage.UseEnergy input)
        {
            var result = equipment.DeleteByIdUseEnergyAsync(input);
            return result;
        }

        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPut]
        public Task<Response<bool>> PutUseEnergyAsync(LJX.SmartPark.Domain.EnergyManage.UseEnergy input)
        {
            var result = equipment.PutUseEnergy(input);

            return result;
        }

        #endregion
    }
}
